import axios, { AxiosError, AxiosRequestConfig, AxiosResponse } from "axios";

const instance = axios.create({
  timeout: 10000,
  baseURL: ''
});

instance.interceptors.request.use((config: AxiosRequestConfig) => {
  return config;
});

instance.interceptors.response.use(
  (response: AxiosResponse) => {
    const { status, data } = response;
    return Promise.resolve(data);
  },
  (err: AxiosError) => {
    Promise.reject(err);
  }
);

export default instance;